package com.ruoyi.website.gateway.feign;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

//@FeignClient(name = "ruoyi-user")
public interface UserService {


    @PostMapping("user/sms/mobile")
    public AjaxResult mobileMessage(@RequestBody ShortMessageParams params);

    @PostMapping("user/sms/email")
    public AjaxResult emailMessage(@RequestBody ShortMessageParams params);


    @PostMapping("/user/register")
    public AjaxResult register(@Parameter(description = "注册类型 1:手机号 2:邮箱") @RequestParam Integer type,
                               @Parameter(description = "手机号") @RequestParam(required = false) String phone,
                               @Parameter(description = "邮箱") @RequestParam(required = false) String email,
                               @Parameter(description = "密码") @RequestParam String password,
                               @Parameter(description = "验证码") @RequestParam String code,
                               @Parameter(description = "验证码ID") @RequestParam String messageId);

    @PostMapping("/user/auth/login")
    public AjaxResult login(@RequestBody LoginInfo info);

    @PostMapping("/user/auth/logout")
    public AjaxResult logout(@RequestParam String sessionId);

    @GetMapping("/user/info/by/sessionId")
    public AjaxResult getUserDetailBySessionId(@RequestParam String sessionId);

    @GetMapping("/user/info/by/uid")
    public AjaxResult getUserDetailByUid(@RequestParam String uid);

    @PostMapping("/user/user/password/update")
    public AjaxResult updatePassword(@RequestParam String uid,
                                     @RequestParam String oldPassword,
                                     @RequestParam String newPassword);

    @PostMapping("/user/user/password/reset")
    public AjaxResult resetPassword(@RequestParam String uid,
                                    @RequestParam String newPassword);

    @PostMapping("/user/user/phone/update")
    public AjaxResult updatePhone(@RequestParam String uid,
                                  @RequestParam String newPhone,
                                  @RequestParam String code,
                                  @RequestParam String messageId);

    @PostMapping("/user/user/email/update")
    public AjaxResult updateEmail(@RequestParam String uid,
                                  @RequestParam String newEmail,
                                  @RequestParam String code,
                                  @RequestParam String messageId);

    @PostMapping("/user/user/info/update")
    public AjaxResult updateUserInfo(@RequestBody UserDetail userDetail);

    @GetMapping("/user/user/paging/list")
    public TableDataInfo getUserList(@RequestParam(required = false) String phone,
                                     @RequestParam(required = false) String email,
                                     @RequestParam(required = false) Integer status,
                                     @RequestParam(required = false) String startTime,
                                     @RequestParam(required = false) String endTime,
                                     @RequestParam(defaultValue = "1", value = "page") Integer pageNum,
                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize);

    @GetMapping("/user/user/language")
    public AjaxResult getUserLanguage(@RequestParam(required = false) String ip);


}
